package cn.supermaster.management.web.controller.tool;

import cn.supermaster.management.web.service.tool.IGenService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.controller.tool
 * @ClassName: GenController
 * @Description: [代码生成器]
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/13 20:01
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.com Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Controller
@RequestMapping("/tool/gen")
public class GenController {

    @Autowired
    private IGenService genService;

    @RequiresPermissions("tool:gen:view")
    @GetMapping()
    public String skipGenIndexHtml() {
        return genService.skipGenIndexHtml();
    }

    /**
     * 导入表结构
     */
    @RequiresPermissions("tool:gen:list")
    @GetMapping("/importTable")
    public String skipImportTableHtml() {
        return genService.skipImportTableHtml();
    }

    /**
     * 修改代码生成业务
     */
    @GetMapping("/edit/{tableId}")
    public String skipModifyGenHtml(@PathVariable("tableId") Long tableId, ModelMap modelMap) {
        return genService.skipModifyGenHtml(modelMap, tableId);
    }
}